/*
 *    Author: Zhenghuabin
 *   Created: Thu Jan 16 15:45:45 2014
 *
 */
#include "gtest/gtest.h"
#include "async_http_client.h"
#include "test_callback.h"
#include <glog/logging.h>

TEST(COMMON, async_http_client) {
    const std::string host = "www.newsmth.net";
    const std::string port = "80";
    const std::string path = "/nForum/index";
    std::map<std::string, std::string> query_strings;

    TestCallback::status_ = 500;
    boost::asio::io_service io_service;
    boost::shared_ptr<common::util::AsyncHttpClient> client(new common::util::AsyncHttpClient(io_service));
    boost::shared_ptr<TestCallback> callback(new TestCallback());
    client->perform(host, port, path, query_strings,
                   std::string(), callback);
    io_service.run();
    EXPECT_EQ(200, int(TestCallback::status_));
}

